#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long
struct person {
    int t, x;
    person(int a, int b): t(a), x(b){}
};
bool compare(person& x, person& y) {
    if(x.t == y.t) return x.x < y.x;
    return x.t < y.t;
}
vector<person> a;
signed main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        a.push_back(person(temp, i + 1));
    }
    sort(a.begin(), a.end(), compare);
    int ans = 0;
    int t = 0;
    for(int i = 0; i < n - 1; i++)
    {
        t += a[i].t;
        ans += t;
    }
    for(auto s : a) {
        cout << s.x << " ";
    }
    cout << endl;
    printf("%.2lf", (double)ans / n);
    return 0;
}